#ifndef PRODUCT_DICT_H
#define PRODUCT_DICT_H

#include "splitTool.h"
#include "inicpp.hpp"

#include <vector>
#include <string>
#include <utility>
#include <map>
#include <set>

using std::vector;
using std::string;
using std::pair;
using std::map;
using std::set;

//生成字典
class DictProducer
{
public:
    DictProducer(SplitTool* spliteTool, inicpp::IniManager* ini);
    void buildEnDict();
    void buildCnDict();
    void createEnglishIndex(string arg);
    void createChineseIndex(string arg);

private:
    void cleanoutEnglishData();//清洗英文数据
    //void cutEnglishWord();//切割英文单词
    void readStopWord(string filePath);//读取停用词
    void outputWordFrequence(string filepath);//导出去除停用词后的词频文件

    vector<string> getFileNamesInDirectory(const string& directoryPath);
    vector<string> getFileNamesInDirectoryAndMove(const string& directoryPath);

private:
    vector<string> _words;//切割后的词
    vector<pair<string,int>> _dict;//词频
    map<string,set<int>> _index;//词典位置索引
    SplitTool* _cuttor;//jieba类指针
    set<string> _stop_words;//停用词

    //创建加载配置文件的对象
    inicpp::IniManager* _ini;
};

#endif //PRODUCT_DICT_H
